/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.farent.solutions.plugins.stripes.hyperstripes.core.tags;

import com.farent.solutions.plugins.stripes.hyperstripes.core.ajax.AjaxResponseInsert;
import com.farent.solutions.plugins.stripes.hyperstripes.core.ComponentModel;
import com.farent.solutions.plugins.stripes.hyperstripes.core.ComponentTagHandler;
import com.farent.solutions.plugins.stripes.hyperstripes.core.TagHandler;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import org.mvel2.templates.CompiledTemplate;
import org.mvel2.templates.TemplateCompiler;
import org.mvel2.templates.TemplateRuntime;

/**
 *
 * @author user
 */
@TagHandler("script")
public class ScriptTagHandler implements ComponentTagHandler
{
    @Override
    public String createContent(ComponentModel model, Object bindings) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public String createScripts(ComponentModel model) {
        Map variables = new HashMap();
        variables.put("model", model);
        InputStream template3 = InputTagHandler.class.getResourceAsStream("script.tag");
        CompiledTemplate compiled3 = TemplateCompiler.compileTemplate(template3);
        String output =  (String) TemplateRuntime.execute(compiled3, variables);
        return output;
    }

    @Override
    public AjaxResponseInsert createAjaxInsert(ComponentModel model, Object bindings) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void createContent(ComponentModel model, Object bindings, OutputStream outputStream) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
